package com.katarina.ad;

import com.katarina.ad.helpers.SpringContextHelper;
import com.katarina.ad.panels.RootPanel;
import com.vaadin.Application;
import com.vaadin.ui.Window;

public class Katarina extends Application {
  private static final long serialVersionUID = -5937565619859934518L;
  private static Katarina instance;

  public static Katarina getInstance() {
    if (instance == null) {
      instance = new Katarina();
    }
    return instance;
  }

  public Katarina() {
    if (instance == null) {
      instance = this;
    }
  }
  @Override
  public void init() {
    SpringContextHelper helper = new SpringContextHelper(this);
    Window mainWindow = new Window("Katarina Application");
    mainWindow.setSizeFull();
    RootPanel rootPanel = (RootPanel) helper.getBean("rootPanel");
    mainWindow.setContent(rootPanel);
    setMainWindow(mainWindow);
  }
}